-- 相争之咒
local xiangzhengzhizhou = fk.CreateSkill {
    name = "mcdh_xiangzhengzhizhou",
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

xiangzhengzhizhou:addEffect('active',{
    prompt = "#mcdh_xiangzhengzhizhou-active",
    anim_type = "offensive",
    can_use = function(self, player)
        return player:usedSkillTimes(self.name, Player.HistoryPhase) == 0
    end,
    card_num = 1,
    card_filter = Util.TrueFunc,
    target_num = 2,
    target_filter = function(self,player, to_select, selected)
        if #selected < 2 and to_select ~= player then
            if #selected ~= 0 then
                local source = selected[1]
                local target = to_select
                return source and target and source:canUseTo(
                        Fk:cloneCard("slash"),
                        target,
                        { bypass_distances = true }
                )
            end
            return true
        end
    end,
    on_use = function(self, room, effect)
        room:obtainCard(
                effect.tos[2],
                effect.cards[1],
                Fk:currentRoom():getCardArea(effect.cards[1]) == Card.PlayerEquip,
                fk.ReasonPrey,
                effect.from
        )
        local slash = Fk:cloneCard("slash")
        slash.skillName = self.name
        local new_use = {
                          from = effect.tos[1],
                          tos = { effect.tos[2]},
                          card = slash,
                          extraUse = true
        }
        room:useCard(new_use)
    end,
})

Fk:loadTranslationTable {
    ["mcdh_xiangzhengzhizhou"] = "怨咒",
    [":mcdh_xiangzhengzhizhou"] = "『相争之咒』<br>出牌阶段限一次，你可以选择两名其他角色，交给后者一张牌，令前者对其视为使用一张无距离限制的【杀】。",
    ["#mcdh_xiangzhengzhizhou-active"] = "相争之咒:选择两名其他角色，你交给后选择的角色一张牌，令先选择的角色视为对其使用【杀】",
}

return xiangzhengzhizhou